"""
    AUTHOR
        策略工厂
    DESCRIPTION
        生成策略
"""
from QuetionPolicy import All, Special, WorryCallback, FunctionDecorator

mapper = {
    "全面测试": (All.AllStrategy, False),
    "专题测试": (Special.SpecialStrategy, True),
    "错题回顾": (WorryCallback.WorryCallback, True),
    "推荐测试": ...,
    "娱乐模式": ...,
    "固定模式": ...
}


class Factory:
    @staticmethod
    def Generate(module, Arg=None, many=-1):
        """
        @desc 策略工厂
        @param module: 策略引子
        @param Arg: 策略参数
        @param many:  数目 为-1表示不使用装饰器
        @return: 对应策略所得到的List
        """
        if Arg:
            list_tmp = FunctionDecorator.Decorator(mapper[module][0], Arg).LimitNumber(many)
        else:
            list_tmp = FunctionDecorator.Decorator(mapper[module][0]).LimitNumber(many)
        return list_tmp

if __name__ == '__main__':
    ret = Factory.Generate("全面测试", many=120)
    print(ret)
    print(len(ret))